creating stored procedure in postgresql